package com.weipai.education.dao.impl;

import com.weipai.education.dao.ExchangeDao;
import com.weipai.education.mapper.ExchangeDetailMapper;
import com.weipai.education.mapper.ExchangeMapper;
import com.weipai.education.model.Exchange;
import com.weipai.education.model.ExchangeDetail;
import org.omg.CORBA.Object;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @Author: 曹朋飞
 * @Date: 2018/12/17 17:26
 */
@Repository
public class ExchangeDaoImpl implements ExchangeDao {

    @Autowired
    private ExchangeMapper exchangeMapper;
    @Autowired
    private ExchangeDetailMapper exchangeDetailMapper;


    @Override
    public int save(Exchange exchange) {
        return exchangeMapper.insert(exchange);
    }

    @Override
    public List<Map<String, Object>> list(Integer start, Integer size, String startTime, String endTime, String orderType, String userId, String orderNumber) {
        return exchangeMapper.list(start, size, startTime, endTime, orderType, userId, orderNumber);
    }

    @Override
    public Integer listAmount(String startTime, String endTime, String orderType, String userId, String orderNumber) {
        return exchangeMapper.listAmount(startTime, endTime, orderType, userId, orderNumber);
    }

    @Override
    public Exchange selectByPrimaryKey(String id) {
        return exchangeMapper.selectByPrimaryKey(Integer.parseInt(id));
    }

    @Override
    public int updateByPrimaryKeySelective(Exchange exchange) {
        return exchangeMapper.updateByPrimaryKeySelective(exchange);
    }

    @Override
    public List<Map<String, Object>> exchangeInfo(String id) {
        return exchangeMapper.exchangeInfo(id);
    }

    @Override
    public void insertExchangeDetail(ExchangeDetail exchangeDetail) {
        exchangeDetailMapper.insert(exchangeDetail);
    }

    @Override
    public Exchange selectExchangeByExchangeNumber(String exchangeNumber) {
        return exchangeMapper.selectExchangeByExchangeNumber(exchangeNumber);
    }

    @Override
    public List<Map<String, java.lang.Object>> getExchangeDetail(String exchangeNumber) {
        return exchangeDetailMapper.getExchangeDetail(exchangeNumber);
    }

}
